
#include <parsing/Lexer.h>

Lexer::Lexer(const char* arg) {
	source = arg;
}

bool Lexer::hasNext() {
	while (*source == ' ' || *source == '\n' || *source == '\r') {
		source++;
	}
	return *source != 0;
}

std::string Lexer::next() {
	if (hasNext()) {
		std::string result;
		while (!(*source == ' ' || *source == '\n' || *source == '\r' || *source == 0)) {
			result += *source;
			source++;
		}
		return result;
	} else {
		return std::string();
	}
}
